# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=bbqsql
pkgver=261.b9859d2
pkgrel=5
groups=('blackarch' 'blackarch-webapp' 'blackarch-exploitation')
pkgdesc='SQL injection exploit tool.'
arch=('any')
url='https://github.com/neohapsis/bbqsql'
license=('BSD')
depends=('python2' 'python2-requests' 'python2-gevent' 'python2-eventlet'
         'python2-configparser')
makedepends=('git' 'python2-setuptools')
source=("git+https://github.com/neohapsis/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|import os|import os, pwd\nos.getlogin = lambda: pwd.getpwuid(os.getuid())[0]|' bbqsql/menu/bbq_core.py
}

build() {
  cd $pkgname

  python2 setup.py build
}

package() {
  cd $pkgname

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

